26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
76 else if(SpeedTagVal == 77)
80 else if(SpeedTagVal == 78)
84 else if(SpeedTagVal == 79)
88 else if(SpeedTagVal == 96)
92 else if(SpeedTagVal == 129)
96 else if(SpeedTagVal == 130)
100 else if(SpeedTagVal == 131)
104 else if(SpeedTagVal == 145)
108 else if(SpeedTagVal == 146)
117 FixedNamedLocationElement(false)
119 for(
int x = 0; x < 4; x++)
130 AnsiString(VLocInput));
143 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
157 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
173 Graphics::TBitmap *GraphicOutput = GraphicPtr;
175 if(LocationName ==
"")
220 GraphicOutput = GraphicPtr;
224 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
233 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
234 AnsiString(TrainIDOnBridgeTrackPos01) +
"," + AnsiString(TrainIDOnBridgeTrackPos23) +
",EndTrkEl,";
243 if(lower.second < higher.second)
247 else if(lower.second > higher.second)
251 else if(lower.second == higher.second)
253 if(lower.first < higher.first)
266 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
267 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
271 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
282 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
310 {2, 4}, {6, 2}, {8, 6}, {4, 8},
311 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
321 else if(
Link[2] == -1)
334 else if(
Link[2] == -1)
343 for(
int x = 0; x < 16; x++)
345 if((Entry == EXArray[x][0]) && (Exit == EXArray[x][1]) || (Entry == EXArray[x][1]) && (Exit == EXArray[x][0]))
521 throw Exception(
"Error in EntryExitNumber 4");
616 throw Exception(
"Error in EntryExitNumber 5");
713 throw Exception(
"Error in EntryExitNumber 6");
803 throw Exception(
"Error in EntryExitNumber 10");
893 throw Exception(
"Error in EntryExitNumber 11");
989 throw Exception(
"Error in EntryExitNumber 7");
1020 throw Exception(
"Error in EntryExitNumber 8");
1031 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1033 if(!AutoSigsFlag && !PrefDirRoute)
1037 else if(!AutoSigsFlag && PrefDirRoute)
1048 throw Exception(
"Error in EntryExitNumber 9");
1092 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
1117 AnsiString NL =
'\n';
1119 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable; " + NL + NL +
1120 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1121 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1122 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1129 int InternalLinkCheckArray[9][2] =
1130 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1135 for(
int x = 0; x < 9; x++)
1137 for(
int y = 0; y < 2; y++)
1144 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1146 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1147 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1148 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1149 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
1150 << 60 << 61 << 62 << 63 << 68 << 69 << 70 << 71 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
1156 int HVArray[10][2] =
1157 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1159 for(
int x = 0; x < 10; x++)
1161 for(
int y = 0; y < 2; y++)
1170 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1173 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1174 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1176 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1177 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1179 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1180 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1183 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1186 for(
int x = 0; x < 40; x++)
1192 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1195 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1196 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1198 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1199 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1201 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1202 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1205 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1208 for(
int x = 0; x < 40; x++)
1214 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1217 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1218 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1220 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1221 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1223 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1224 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1227 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1230 for(
int x = 0; x < 40; x++)
1256 for(
int x = 0; x < 40; x++)
1283 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1284 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1285 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1286 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1287 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1288 {0, 0, 129}, {0, -1, 145},
1291 for(
int x = 0; x < 25; x++)
1293 for(
int y = 0; y < 3; y++)
1301 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1302 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1303 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1304 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1305 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1306 {0, 0, 129}, {0, 1, 145},
1309 for(
int x = 0; x < 25; x++)
1311 for(
int y = 0; y < 3; y++)
1319 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1320 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1321 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1322 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1323 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1324 {0, 0, 130}, {-1, 0, 146},
1327 for(
int x = 0; x < 25; x++)
1329 for(
int y = 0; y < 3; y++)
1337 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1338 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1339 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1340 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1341 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1342 {0, 0, 130}, {1, 0, 146},
1345 for(
int x = 0; x < 25; x++)
1347 for(
int y = 0; y < 3; y++)
1355 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1356 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1357 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1358 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1359 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1360 {0, -1, 129}, {1, 0, 130},
1361 {-1, 0, 130}, {0, 1, 145},
1362 {0, -1, 145}, {1, 0, 146},
1365 for(
int x = 0; x < 28; x++)
1367 for(
int y = 0; y < 3; y++)
1385 for(
int x = 0; x < 8; x++)
1387 for(
int y = 0; y < 3; y++)
1405 for(
int x = 0; x < 8; x++)
1407 for(
int y = 0; y < 3; y++)
1425 for(
int x = 0; x < 8; x++)
1427 for(
int y = 0; y < 3; y++)
1445 for(
int x = 0; x < 8; x++)
1447 for(
int y = 0; y < 3; y++)
1455 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1457 for(
int x = 0; x < 4; x++)
1459 for(
int y = 0; y < 3; y++)
1467 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1468 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1469 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1470 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1476 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1477 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1478 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1479 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1485 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1486 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1487 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1488 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1494 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1495 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1496 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1497 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1519 delete UGMIt->second;
1595 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1596 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1598 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1605 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1606 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1619 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1620 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1622 {4, 6, 2, 8}, {1, 9, 3, 7},
1624 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1626 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1629 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1630 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1631 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1632 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1633 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1634 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1635 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1637 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1638 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1639 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1640 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1641 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1642 {4, 6, -1, -1}, {2, 8, -1, -1},
1644 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1646 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1648 {4, 6, -1, -1}, {2, 8, -1, -1},
1653 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1654 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1655 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1656 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1659 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1660 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1661 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1663 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1664 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1665 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1667 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1669 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1670 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1671 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1672 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1673 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1674 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1675 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1676 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1677 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1678 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1679 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1680 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1681 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1683 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1684 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1685 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1686 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1687 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1688 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1689 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1690 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1694 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1695 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1696 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1702 for(
int x = 0; x < 17; x++)
1704 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1706 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1710 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1716 ExistingGraphicLoaded(false), Width(16), Height(16)
1728 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1766 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1770 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1774 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1778 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1801 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1804 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1808 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1812 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1846 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1867 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1881 bool TrackPresent =
false;
1895 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1899 TrackPresent =
true;
1904 return(!TrackPresent);
1912 bool TrackPresent =
false;
1921 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1925 TrackPresent =
true;
1931 return(!TrackPresent);
1936 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1939 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1940 TrackEraseSuccessfulFlag =
false;
1945 ErasedTrackVectorPosition = -1;
1946 AnsiString SName =
"", ErrorString;
1948 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1954 TrackMapKeyPair.first = HLocInput;
1955 TrackMapKeyPair.second = VLocInput;
1956 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1967 if(ErrorString !=
"")
1969 throw Exception(ErrorString +
" for EraseTrackElement 1");
1993 ErasedTrackVectorPosition = VecPos;
1994 TrackEraseSuccessfulFlag =
true;
2000 unsigned int VecPos;
2001 InactiveTrackMapKeyPair.first = HLocInput;
2002 InactiveTrackMapKeyPair.second = VLocInput;
2007 VecPos = InactiveTrack2MultiMapIterator->second;
2012 if(ErrorString !=
"")
2014 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2024 TrackEraseSuccessfulFlag =
true;
2045 VecPos = InactiveTrack2MultiMapIterator->second;
2050 if(ErrorString !=
"")
2052 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2076 if(TrackEraseSuccessfulFlag)
2098 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2099 bool PlatAllowedFlag =
false;
2101 TrackLinkingRequiredFlag =
false;
2113 LocationNameEntry.first =
"";
2121 TempTrackElement.
HLoc = HLocInput;
2122 TempTrackElement.
VLoc = VLocInput;
2148 else if(Aspect == 1)
2152 else if(Aspect == 2)
2156 else if(Aspect == 3)
2165 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2168 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2170 if(InactiveFoundFlag)
2174 NonStationOrLevelCrossingPresent =
true;
2178 NonStationOrLevelCrossingPresent =
true;
2182 PlatformPresent =
true;
2193 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2201 PlatAllowedFlag =
true;
2205 PlatAllowedFlag =
true;
2209 PlatAllowedFlag =
true;
2213 PlatAllowedFlag =
true;
2217 TrackLinkingRequiredFlag =
true;
2245 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2246 (!FoundFlag && !InactiveFoundFlag))
2249 TrackLinkingRequiredFlag =
true;
2281 TrackLinkingRequiredFlag =
true;
2293 else if(FoundFlag || InactiveFoundFlag)
2312 bool BothPointFillets =
true;
2327 TrackLinkingRequiredFlag =
true;
2341 bool InternalChecks)
2345 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2346 bool PlatAllowedFlag =
false;
2348 TrackLinkingRequiredFlag =
false;
2351 LocationNameEntry.first =
"";
2357 TempTrackElement.
HLoc = HLocInput;
2358 TempTrackElement.
VLoc = VLocInput;
2359 for(
int x = 0; x < 4; x++)
2365 TempTrackElement.
Conn[x] = -1;
2369 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2380 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2382 if(InactiveFoundFlag)
2386 NonStationOrLevelCrossingPresent =
true;
2390 NonStationOrLevelCrossingPresent =
true;
2394 PlatformPresent =
true;
2405 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2413 PlatAllowedFlag =
true;
2417 PlatAllowedFlag =
true;
2421 PlatAllowedFlag =
true;
2425 PlatAllowedFlag =
true;
2429 TrackLinkingRequiredFlag =
true;
2460 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2461 (!FoundFlag && !InactiveFoundFlag))
2464 TrackLinkingRequiredFlag =
true;
2499 TrackLinkingRequiredFlag =
true;
2511 else if(FoundFlag || InactiveFoundFlag)
2530 bool BothPointFillets =
true;
2545 TrackLinkingRequiredFlag =
true;
2575 ShowMessage(
"Gaps must be set before track can be validated");
2585 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2596 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2613 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2620 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2644 std::pair<AnsiString, char>TempMapPair;
2652 TempMapPair.second =
'x';
2665 int NewHLoc, NewVLoc;
2666 bool ConnectionFoundFlag, LinkFoundFlag;
2668 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2670 for(
unsigned int y = 0; y < 4; y++)
2688 ConnectionFoundFlag =
false;
2689 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2695 ConnectionFoundFlag =
true;
2697 LinkFoundFlag =
false;
2698 for(
unsigned int a = 0; a < 4; a++)
2702 LinkFoundFlag =
true;
2718 if(!ConnectionFoundFlag)
2793 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2810 bool UnsetGaps =
false;
2817 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2821 for(
unsigned int y = 0; y < 4; y++)
2833 for(
unsigned int y = 0; y < 4; y++)
2843 for(
unsigned int y = 1; y < 4; y++)
2852 for(
unsigned int y = 0; y < 4; y++)
2865 for(
unsigned int y = 0; y < 4; y++)
2893 int NumberOfActiveElements = 0;
2895 GraphicsFollow =
false;
2899 if(MarkerString[MarkerString.Length()] ==
'1')
2901 GraphicsFollow =
true;
2903 for(
int x = 0; x < NumberOfActiveElements; x++)
2909 TrackElement.
HLoc = TempInt;
2911 TrackElement.
VLoc = TempInt;
2917 TrackElement.
Conn[0] = TempInt;
2941 if((TempInt != -1) && (TempInt < 10))
2951 if((TempInt != -1) && (TempInt < 10))
2968 if(Marker[1] ==
'3')
2972 else if(Marker[1] ==
'2')
2976 else if(Marker[1] ==
'G')
2990 int NumberOfInactiveElements = 0;
2994 for(
int x = 0; x < NumberOfInactiveElements; x++)
3000 TrackElement.
HLoc = TempInt;
3002 TrackElement.
VLoc = TempInt;
3008 bool LocError =
false;
3037 for(
int x = 0; x < NumberOfGraphics; x++)
3048 bool FileError =
false;
3050 for(
int x = 0; x < NumberOfGraphics; x++)
3063 UGME.second =
new TPicture;
3064 UGME.second->LoadFromFile(
UGME.first);
3067 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3074 catch(
const EInvalidGraphic &e)
3083 delete UGMIt->second;
3088 catch(
const Exception &e)
3097 delete UGMIt->second;
3105 bool FoundInMap =
false;
3124 UGME.second =
new TPicture;
3125 UGME.second->LoadFromFile(
UGME.first);
3128 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3135 catch(
const EInvalidGraphic &e)
3144 delete UGMIt->second;
3149 catch(
const Exception &e)
3158 delete UGMIt->second;
3183 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3187 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3189 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3192 VecFile << x <<
'\n';
3193 VecFile << TrackElement.
SpeedTag <<
'\n';
3194 VecFile << TrackElement.
HLoc <<
'\n';
3195 VecFile << TrackElement.
VLoc <<
'\n';
3199 VecFile << TrackElement.
Conn[0] <<
'\n';
3203 VecFile << TrackElement.
Attribute <<
'\n';
3209 VecFile << int(1) <<
'\n';
3213 VecFile << int(0) <<
'\n';
3216 VecFile << TrackElement.
Length01 <<
'\n';
3217 VecFile << TrackElement.
Length23 <<
'\n';
3220 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3227 VecFile <<
"3*****" <<
'\0' <<
'\n';
3231 VecFile <<
"2*****" <<
'\0' <<
'\n';
3235 VecFile <<
"G*****" <<
'\0' <<
'\n';
3239 VecFile <<
"4*****" <<
'\0' <<
'\n';
3244 VecFile <<
"******" <<
'\0' <<
'\n';
3249 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3253 VecFile << x <<
'\n';
3254 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3255 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3256 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3257 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3258 VecFile <<
"******" <<
'\0' <<
'\n';
3273 GraphicsFollow =
false;
3275 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3281 AnsiString MarkerString;
3288 if(MarkerString[MarkerString.Length()] ==
'1')
3290 GraphicsFollow =
true;
3292 for(
int x = 0; x < NumberOfActiveElements; x++)
3300 int SpeedTag = TempInt;
3307 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3313 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3318 if((SpeedTag > 87) && (SpeedTag < 96))
3321 if((TempInt < -1) || (TempInt > 3))
3327 if((TempInt < -1) || (TempInt > 999999))
3333 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3334 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3337 if((TempInt < -1) || (TempInt > 5))
3343 if((SpeedTag >= 68) && (SpeedTag <= 75))
3346 if((TempInt != 0) && (TempInt != 1))
3353 if((TempInt < -1) || (TempInt > 999999))
3359 if((TempInt < -1) || (TempInt > 999999))
3365 if((TempInt < -1) || (TempInt > 999999))
3371 if((TempInt < -1) || (TempInt > 999999))
3392 int NumberOfInactiveElements = 0;
3395 if(NumberOfInactiveElements < 0)
3405 for(
int x = 0; x < NumberOfInactiveElements; x++)
3419 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3425 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3452 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3458 AnsiString FileName =
"", TempStr =
"";
3460 for(
int x = 0; x < NumberOfGraphics; x++)
3462 TPicture *TempPicture =
new TPicture;
3471 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3484 catch(
const EInvalidGraphic &e)
3489 for(
int y = x + 1; y < NumberOfGraphics; y++)
3495 ShowMessage(FileName +
3496 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3501 catch(
const Exception &e)
3506 for(
int y = x + 1; y < NumberOfGraphics; y++)
3512 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3513 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3531 for(
int x = 0; x < VecSize; x++)
3554 for(
int x = 0; x < VecSize; x++)
3576 for(
int x = 0; x < VecSize; x++)
3630 for(
int x = 0; x < VecSize; x++)
3688 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3706 if(BothPointFilletsAndBasicLCs)
3781 Bitmap->Canvas->CopyMode = cmSrcCopy;
3783 Graphics::TBitmap *GraphicOutput;
3955 for(
int x = 0; x < 40; x++)
3984 Graphics::TBitmap *GraphicPtr;
3999 Graphics::TBitmap* SignalPlatformGraphic;
4032 if(OldTransparentColour !=
clB5G5R5)
4055 Bitmap->Canvas->CopyMode = cmSrcCopy;
4083 Bitmap->Canvas->CopyMode = cmSrcCopy;
4085 Graphics::TBitmap *GraphicOutput;
4095 if(BaseElement == 1)
4183 for(
int x = 0; x < 40; x++)
4212 Graphics::TBitmap *GraphicPtr;
4227 Graphics::TBitmap* SignalPlatformGraphic;
4288 for(
int x = 0; x < 40; x++)
4296 Graphics::TBitmap* SignalPlatformGraphic;
4317 if(OldTransparentColour !=
clB5G5R5)
4331 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4403 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4417 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4443 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4468 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4498 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4532 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4569 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4584 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4613 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4620 throw Exception(
"Error - Map & Vector different sizes");
4622 unsigned int NonZeroCount = 0;
4624 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4633 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4639 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4643 TrackMapEntry.first = TrackMapKeyPair;
4644 TrackMapEntry.second = x;
4645 if(!(
TrackMap.insert(TrackMapEntry).second))
4647 throw Exception(
"Error - map insertion failure, TrackVector in error");
4651 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4653 for(
unsigned int y = 0; y < 4; y++)
4678 THVPair GapMapKeyPair, GapMapValuePair;
4681 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4687 GapMapEntry.first = GapMapKeyPair;
4690 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4694 GapMapEntry.second = GapMapValuePair;
4697 GapMap.insert(GapMapEntry);
4710 bool CheckForLinks =
false;
4712 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4724 "Footbridge or underpass connection error. Each end must connect to a platform, concourse or other footbridge or underpass, and they can't connect to each other");
4732 for(
unsigned int y = 0; y < 4; y++)
4734 CheckForLinks =
false;
4752 bool ConnectionFoundFlag;
4756 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4762 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4771 if(ConnectionFoundFlag)
4775 bool LinkFoundFlag =
false;
4779 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4785 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4791 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4799 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4805 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
4812 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4816 CheckForLinks =
true;
4820 for(
unsigned int a = 0; a < 4; a++)
4829 LinkFoundFlag =
true;
4842 throw Exception(
"Error in final track linkage - invalid link");
4856 throw Exception(
"Error in final track linkage - connection not found");
4869 bool ConnErrorFlag =
false;
4871 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4875 ConnErrorFlag =
true;
4879 ConnErrorFlag =
true;
4883 ConnErrorFlag =
true;
4887 ConnErrorFlag =
true;
4891 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
4893 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
4895 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
4904 throw Exception(
"ConnError in LinkTrack - Final");
4908 throw Exception(
"ConnError in LinkTrack - Precheck");
4911 bool CLkErrorFlag =
false;
4913 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4917 CLkErrorFlag =
true;
4921 CLkErrorFlag =
true;
4925 CLkErrorFlag =
true;
4929 CLkErrorFlag =
true;
4937 throw Exception(
"CLkError in LinkTrack - Final");
4941 throw Exception(
"CLkError in LinkTrack - Precheck");
4945 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4974 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4990 for(
unsigned int y = 0; y < 4; y++)
5009 bool ConnectionFoundFlag;
5015 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5024 if(ConnectionFoundFlag)
5027 bool LinkFoundFlag =
false;
5084 for(
unsigned int a = 0; a < 4; a++)
5093 LinkFoundFlag =
true;
5101 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5111 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5124 bool ConnErrorFlag =
false;
5126 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5130 ConnErrorFlag =
true;
5134 ConnErrorFlag =
true;
5138 ConnErrorFlag =
true;
5142 ConnErrorFlag =
true;
5146 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
5148 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
5150 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5159 throw Exception(
"ConnError in LinkTrack - Final");
5163 throw Exception(
"ConnError in LinkTrack - Precheck");
5166 bool CLkErrorFlag =
false;
5168 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5172 CLkErrorFlag =
true;
5176 CLkErrorFlag =
true;
5180 CLkErrorFlag =
true;
5184 CLkErrorFlag =
true;
5192 throw Exception(
"CLkError in LinkTrack - Final");
5196 throw Exception(
"CLkError in LinkTrack - Precheck");
5200 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5229 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5245 for(
unsigned int y = 0; y < 4; y++)
5264 bool ConnectionFoundFlag =
false;
5266 if(ConnectionFoundFlag)
5270 bool LinkFoundFlag =
false;
5290 for(
unsigned int a = 0; a < 4; a++)
5299 LinkFoundFlag =
true;
5319 bool ConnErrorFlag =
false;
5321 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5325 ConnErrorFlag =
true;
5329 ConnErrorFlag =
true;
5333 ConnErrorFlag =
true;
5337 ConnErrorFlag =
true;
5345 bool CLkErrorFlag =
false;
5347 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5351 CLkErrorFlag =
true;
5355 CLkErrorFlag =
true;
5359 CLkErrorFlag =
true;
5363 CLkErrorFlag =
true;
5381 int Position1, Position2;
5387 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5389 int HLoc1 = GapMapPtr->first.first;
5390 int VLoc1 = GapMapPtr->first.second;
5391 int HLoc2 = GapMapPtr->second.first;
5392 int VLoc2 = GapMapPtr->second.second;
5395 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5399 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5403 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5407 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5425 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5426 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5436 bool FoundFlag =
false;
5448 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5449 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5450 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5479 bool FoundFlag =
false;
5492 TrackMapKeyPair.first = TrackElement.
HLoc;
5493 TrackMapKeyPair.second = TrackElement.
VLoc;
5494 TrackMapEntry.first = TrackMapKeyPair;
5499 LocationNameEntry.second = -(int)(
TrackVector.size());
5539 TrackMapKeyPair.first = HLoc;
5540 TrackMapKeyPair.second = VLoc;
5541 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5551 return(TrackMapPtr->second);
5564 TrackMapKeyPair.first = HLoc;
5565 TrackMapKeyPair.second = VLoc;
5566 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5569 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5570 throw Exception(Message);
5585 THVPair InactiveTrackMapKeyPair;
5588 InactiveTrackMapKeyPair.first = HLoc;
5589 InactiveTrackMapKeyPair.second = VLoc;
5593 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5594 throw Exception(Message);
5608 bool Present =
true;
5612 TrackMapKeyPair.first = HLoc;
5613 TrackMapKeyPair.second = VLoc;
5614 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5629 bool Present =
true;
5630 THVPair InactiveTrackMapKeyPair;
5633 InactiveTrackMapKeyPair.first = HLoc;
5634 InactiveTrackMapKeyPair.second = VLoc;
5652 THVPair InactiveTrackMapKeyPair;
5657 InactiveTrackMapKeyPair.first = HLoc;
5658 InactiveTrackMapKeyPair.second = VLoc;
5667 if(InactiveTrackRange.first == InactiveTrackRange.second)
5676 RetPair.first = InactiveTrackRange.first->second;
5677 RetPair.second = (--InactiveTrackRange.second)->second;
5690 AnsiString(DivergingPosition));
5701 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5702 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5703 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5704 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5705 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5706 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5707 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5708 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5709 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5710 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5711 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5712 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5746 throw Exception(
"Error, Wrong track type in PlotGap");
5748 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5752 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5756 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5760 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5764 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5768 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5772 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5776 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5780 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5784 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
5788 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
5792 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
5796 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
5800 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
5804 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
5808 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
5822 throw Exception(
"Error, Wrong track type in PlotPoints");
5833 else if(TrackElement.
SpeedTag < 132)
5851 else if(TrackElement.
SpeedTag < 132)
5884 throw Exception(
"Error, Wrong track type in PlotSignal");
5886 for(
int x = 0; x < 40; x++)
5957 for(
int x = 0; x < 40; x++)
5964 Graphics::TBitmap* SignalPlatformGraphic;
6051 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6059 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6067 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6075 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6091 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6099 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6107 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6115 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6148 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6160 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6172 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6184 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6226 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6228 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6230 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6233 if(BaseElementSpeedTag == 1)
6237 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6244 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6252 Graphics::TBitmap *RouteGraphic;
6254 if(TypeOfRoute == 1)
6258 else if(TypeOfRoute == 0)
6264 RouteGraphic = BaseGraphic;
6271 if(UpStep == DownStep)
6274 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6284 else if((DownStep - UpStep) == 1)
6289 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6299 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6312 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6322 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6338 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6348 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6358 else if(DownStep == 0)
6361 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6371 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6384 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6394 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6404 for(
int x = (UpStep + 1); x < DownStep; x++)
6409 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6413 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6434 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6441 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6447 Graphics::TBitmap *RouteGraphic;
6449 if(TypeOfRoute == 1)
6453 else if(TypeOfRoute == 0)
6459 RouteGraphic = BaseGraphic;
6468 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6478 else if((RStep - LStep) == 1)
6483 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6493 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6506 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6516 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6532 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6542 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6555 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6565 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6578 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6588 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6598 for(
int x = (LStep + 1); x < RStep; x++)
6603 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
6607 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
6631 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6634 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6636 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6638 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6641 if(BaseElementSpeedTag == 1)
6645 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
6652 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
6658 if(UpStep == DownStep)
6669 else if((DownStep - UpStep) == 1)
6688 for(
int x = (UpStep + 1); x < DownStep; x++)
6697 for(
int x = (UpStep + 1); x < DownStep; x++)
6704 for(
int x = UpStep; x <= DownStep; x++)
6717 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
6724 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
6741 else if((RStep - LStep) == 1)
6760 for(
int x = (LStep + 1); x < RStep; x++)
6769 for(
int x = (LStep + 1); x < RStep; x++)
6776 for(
int x = LStep; x <= RStep; x++)
6795 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
6797 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6799 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
6802 if(BaseElementSpeedTag == 1)
6806 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
6813 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
6819 for(
int x = UpStep; x < (DownStep + 1); x++)
6834 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
6841 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
6847 for(
int x = LStep; x < (RStep + 1); x++)
6866 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6869 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6871 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6873 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6878 if(BaseElementSpeedTag == 1)
6882 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
6889 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
6895 for(
int x = UpStep; x <= DownStep; x++)
6909 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
6916 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
6922 for(
int x = LStep; x <= RStep; x++)
6938 Graphics::TBitmap *RouteGraphic;
6941 if(BaseElementSpeedTag == 1)
6943 if(TypeOfRoute == 1)
6947 else if(TypeOfRoute == 0)
6953 RouteGraphic = BaseGraphic;
6957 RouteGraphic = BaseGraphic;
6963 if(TypeOfRoute == 1)
6967 else if(TypeOfRoute == 0)
6973 RouteGraphic = BaseGraphic;
6977 RouteGraphic = BaseGraphic;
6982 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
6987 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6991 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6998 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7001 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7006 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7011 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7015 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7022 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7025 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7150 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7154 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7185 "," + AnsiString(VLoc));
7189 int DummyRouteNumber;
7191 TrainPresent =
false;
7195 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7197 TrackMapKeyPair.first = HLoc;
7198 TrackMapKeyPair.second = VLoc + UpStep;
7199 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7208 TrainPresent =
true;
7222 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7224 TrackMapKeyPair.first = HLoc;
7225 TrackMapKeyPair.second = VLoc + DownStep;
7226 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7235 TrainPresent =
true;
7249 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7251 TrackMapKeyPair.first = HLoc + LeftStep;
7252 TrackMapKeyPair.second = VLoc;
7253 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7262 TrainPresent =
true;
7276 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7278 TrackMapKeyPair.first = HLoc + RightStep;
7279 TrackMapKeyPair.second = VLoc;
7280 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7289 TrainPresent =
true;
7309 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7328 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7335 else if(TrackElement.
SpeedTag < 132)
7353 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7370 AnsiString(ScreenPosV));
7385 AnsiString(ScreenPosV));
7396 AnsiString(VPosTrue));
7410 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7422 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7423 " in TrackMap, Caller=" + (AnsiString)Caller);
7425 if(MapVecPos != (
int)a)
7427 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7428 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7429 (AnsiString)Caller);
7435 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7436 " Caller=" + (AnsiString)Caller);
7456 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7457 " in InactiveMap, Caller=" + (AnsiString)Caller);
7459 if((InactivePair.first != a) && (InactivePair.second != a))
7461 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7462 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7463 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7468 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7469 " Caller=" + (AnsiString)Caller);
7479 int Position1, Position2;
7485 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7487 int HLoc1 = GapMapPtr->first.first;
7488 int VLoc1 = GapMapPtr->first.second;
7489 int HLoc2 = GapMapPtr->second.first;
7490 int VLoc2 = GapMapPtr->second.second;
7493 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7497 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7501 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7505 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7509 unsigned int GapCount = 0;
7511 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7519 if((
GapMap.size() * 2) != GapCount)
7521 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7522 (AnsiString)Caller);
7532 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7536 throw Exception(
"Error - TrackFinished with erase element still present");
7541 AnsiString IDString;
7543 if(TrackElement.
HLoc < 0)
7545 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
7549 IDString = AnsiString(TrackElement.
HLoc) +
"-";
7551 if(TrackElement.
VLoc < 0)
7553 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
7557 IDString += AnsiString(TrackElement.
VLoc);
7571 for(
int x = 1; x < String.Length() + 1; x++)
7573 if(String.IsDelimiter(
"-", x))
7578 if(x == String.Length())
7582 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
7592 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
7597 if(DelimPos == String.Length())
7601 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
7606 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
7610 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
7617 if(String.SubString(1, 1) !=
"N")
7619 for(
int x = 1; x < DelimPos; x++)
7621 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7625 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7632 if(String.SubString(1, 1) ==
"N")
7634 for(
int x = 2; x < DelimPos; x++)
7636 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7640 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7647 if(String.SubString(1, 1) ==
"N")
7649 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
7653 HLoc = String.SubString(1, DelimPos - 1).ToInt();
7655 if(String.SubString(DelimPos + 1, 1) !=
"N")
7657 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
7659 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7663 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7670 if(String.SubString(DelimPos + 1, 1) ==
"N")
7672 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
7674 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7678 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7685 if(String.SubString(DelimPos + 1, 1) ==
"N")
7687 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
7691 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
7696 TrackMapPtr =
TrackMap.find(HVPair);
7701 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
7707 return(TrackMapPtr->second);
7718 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
7719 int HLoc = TrackElement.
HLoc;
7720 int VLoc = TrackElement.
VLoc;
7823 AnsiString(SpeedTag));
7834 if(HVRange.first == HVRange.second)
7841 HVIt1 = HVRange.first;
7846 if(--HVRange.second != HVRange.first)
7848 HVIt2 = HVRange.second;
7852 HVIt2->second).
SpeedTag == SpeedTag)))
7872 AnsiString(SpeedTag));
7938 AnsiString TestString1, TestString2;
7943 throw Exception(
"LNPendingList size not 1 on entry");
7945 int CurrentElementNumber;
7951 int H = CurrentElement->HLoc;
7952 int V = CurrentElement->VLoc;
7953 int Tag = CurrentElement->SpeedTag;
7959 for(
int x = 0; x < 25; x++)
7969 for(
int x = 0; x < 25; x++)
7979 for(
int x = 0; x < 25; x++)
7989 for(
int x = 0; x < 25; x++)
7999 for(
int x = 0; x < 28; x++)
8009 for(
int x = 0; x < 8; x++)
8019 for(
int x = 0; x < 8; x++)
8029 for(
int x = 0; x < 4; x++)
8039 for(
int x = 0; x < 8; x++)
8049 for(
int x = 0; x < 8; x++)
8062 if(CurrentElementNumber > -1)
8067 if((ExistingName !=
"") && (ExistingName != LocationName))
8083 AddName(1, CurrentElement, LocationName);
8087 LNDone2MultiMapEntry.first = HVPair;
8098 bool FoundFlag, ErasedFlag =
false;
8100 if(SNRange.first != SNRange.second)
8104 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8111 TVIt->LocationName =
"";
8112 TVIt->ActiveTrackElementName =
"";
8145 std::pair<AnsiString, char>TempMapPair;
8153 TempMapPair.second =
'x';
8171 AnsiString(SpeedTag));
8181 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8188 int MapPos = -1 - Position;
8192 FoundElement = MapPos;
8208 FoundElement = IMPair.first;
8217 FoundElement = IMPair.second;
8238 AnsiString OldName = TrackElement->LocationName, ErrorString;
8240 TrackElement->LocationName = Name;
8241 int HLoc = TrackElement->HLoc;
8242 int VLoc = TrackElement->VLoc;
8256 if(ErrorString !=
"")
8258 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8282 if(LNDone2MultiMapIterator->second == MapPos)
8309 if(*LNPendingListIterator == MapPos)
8382 if(NameBeingChecked !=
"")
8388 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8396 NameBeingChecked = LNMMRg.second->first;
8398 if(NameBeingChecked !=
"")
8404 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8425 if(LNMMIt->second < 0)
8435 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8443 std::list<THVPair> HVLinkedList;
8446 HVPairsLinkedMap.begin()->second =
true;
8447 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8450 THVPair HVPairUnderExamination;
8451 THVPairsLinkedMap::iterator HVPLMIt;
8453 while(!HVLinkedList.empty())
8455 HVPairUnderExamination = HVLinkedList.front();
8456 HVLinkedList.pop_front();
8457 HVPairNew.first = HVPairUnderExamination.first;
8458 HVPairNew.second = HVPairUnderExamination.second - 1;
8459 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8460 if(HVPLMIt != HVPairsLinkedMap.end())
8462 if(!HVPLMIt->second)
8464 HVLinkedList.push_back(HVPLMIt->first);
8466 HVPLMIt->second =
true;
8468 HVPairNew.first = HVPairUnderExamination.first - 1;
8469 HVPairNew.second = HVPairUnderExamination.second;
8470 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8471 if(HVPLMIt != HVPairsLinkedMap.end())
8473 if(!HVPLMIt->second)
8475 HVLinkedList.push_back(HVPLMIt->first);
8477 HVPLMIt->second =
true;
8479 HVPairNew.first = HVPairUnderExamination.first;
8480 HVPairNew.second = HVPairUnderExamination.second + 1;
8481 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8482 if(HVPLMIt != HVPairsLinkedMap.end())
8484 if(!HVPLMIt->second)
8486 HVLinkedList.push_back(HVPLMIt->first);
8488 HVPLMIt->second =
true;
8490 HVPairNew.first = HVPairUnderExamination.first + 1;
8491 HVPairNew.second = HVPairUnderExamination.second;
8492 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8493 if(HVPLMIt != HVPairsLinkedMap.end())
8495 if(!HVPLMIt->second)
8497 HVLinkedList.push_back(HVPLMIt->first);
8499 HVPLMIt->second =
true;
8504 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
8506 if(!HVPLMIt->second)
8525 if(LocationName ==
"")
8536 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8542 ActiveTrackElementNameMapEntry.first =
Track->
TrackVector.at(x).ActiveTrackElementName;
8543 ActiveTrackElementNameMapEntry.second = 0;
8565 bool FoundFlag, ErasedFlag =
false;
8569 if(SNRange.first != SNRange.second)
8572 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8575 TVIt->LocationName =
"";
8576 TVIt->ActiveTrackElementName =
"";
8610 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
8612 AnsiString LocationName;
8621 if(LocationName !=
"")
8629 if(LocationName !=
"")
8643 if(LocationName !=
"")
8645 int ModifiedPosition = -1 - Position;
8654 for(
int x = 0; x < 25; x++)
8664 else if(SpeedTag == 77)
8666 for(
int x = 0; x < 25; x++)
8676 else if(SpeedTag == 78)
8678 for(
int x = 0; x < 25; x++)
8688 else if(SpeedTag == 79)
8690 for(
int x = 0; x < 25; x++)
8700 else if(SpeedTag == 96)
8702 for(
int x = 0; x < 28; x++)
8712 else if(SpeedTag == 129)
8714 for(
int x = 0; x < 8; x++)
8724 else if(SpeedTag == 130)
8726 for(
int x = 0; x < 8; x++)
8736 else if(SpeedTag == 145)
8738 for(
int x = 0; x < 8; x++)
8748 else if(SpeedTag == 146)
8750 for(
int x = 0; x < 8; x++)
8760 else if(SpeedTag == 131)
8762 for(
int x = 0; x < 4; x++)
8785 AnsiString(SpeedTag));
8797 if(TempElement->LocationName !=
"")
8799 LocationName = TempElement->LocationName;
8800 FoundElement = IMPair.first;
8808 if(TempElement->LocationName !=
"")
8810 LocationName = TempElement->LocationName;
8811 FoundElement = IMPair.second;
8823 if(TempElement->LocationName !=
"")
8825 LocationName = TempElement->LocationName;
8826 FoundElement = -1 - Position;
8842 unsigned int Count = 0;
8849 AnsiString SName, TName, ErrorString;
8851 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8857 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
8858 AnsiString(Caller));
8871 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
8872 AnsiString(Caller));
8879 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
8880 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
8885 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8891 if(ErrorString !=
"")
8893 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
8895 if(SNIt->second != -1 - (
int)x)
8897 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
8898 AnsiString(Caller));
8904 bool FoundFlag =
false;
8913 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
8914 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
8918 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
8919 " & V " + AnsiString(
TrackVector.at(x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
8920 AnsiString(Caller));
8925 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
8926 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
8936 if(ErrorString !=
"")
8938 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
8940 if(SNIt->second != (
int)x)
8942 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
8943 AnsiString(Caller));
8953 AnsiString &ErrorString)
8961 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
8963 bool FoundFlag =
false;
8967 if(SNRange.first == SNRange.second)
8969 ErrorString =
"Error, Name " + LocationName +
" not found in map";
8971 return(SNRange.first);
8975 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8977 if(SNIterator->second < 0)
8979 int TVPos = -1 - SNIterator->second;
8981 if(TVIt == TrackElement)
8990 int ITVPos = SNIterator->second;
8992 if(ITVIt == TrackElement)
9003 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9020 LocationNameEntry.first = NewName;
9021 LocationNameEntry.second = SNIterator->second;
9035 int TruePos = -1 - Position;
9039 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9049 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9072 InactiveTrack2MultiMapIterator++)
9074 if(InactiveTrack2MultiMapIterator->second > VecPos)
9076 InactiveTrack2MultiMapIterator->second--;
9084 LocationNameMultiMapIterator++)
9086 if(LocationNameMultiMapIterator->second < 0)
9090 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9092 LocationNameMultiMapIterator->second--;
9114 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9116 if(TrackMapIterator->second > VecPos)
9118 TrackMapIterator->second--;
9126 LocationNameMultiMapIterator++)
9128 if(LocationNameMultiMapIterator->second >= 0)
9134 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9136 LocationNameMultiMapIterator->second++;
9140 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9146 if(TkEl.
Conn[0] ==
int(VecPos))
9151 if(TkEl.
Conn[0] >
int(VecPos))
9155 if(TkEl.
Conn[0] > -1)
9181 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9187 LocationNameEntry.second = -1 - TVPos;
9198 LocationNameEntry.second = ITVPos;
9240 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9272 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9300 AnsiString((
short)FirstTrack));
9301 bool LengthDifferent =
false, SpeedDifferent =
false;
9308 int EXArray[16][2] =
9310 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9311 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9314 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9315 Graphics::TBitmap *Bitmap;
9319 InLink = TrackElement.
Link[0];
9320 OutLink = TrackElement.
Link[1];
9324 InLink = TrackElement.
Link[2];
9325 OutLink = TrackElement.
Link[3];
9327 for(
int x = 0; x < 16; x++)
9329 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9336 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9355 else if(TrackElement.
SpeedTag == 54)
9359 else if(TrackElement.
SpeedTag == 55)
9370 else if(TrackElement.
SpeedTag == 58)
9374 else if(TrackElement.
SpeedTag == 59)
9379 else if(Index == 14)
9385 else if(TrackElement.
SpeedTag == 52)
9389 else if(TrackElement.
SpeedTag == 57)
9394 else if(Index == 15)
9400 else if(TrackElement.
SpeedTag == 53)
9404 else if(TrackElement.
SpeedTag == 56)
9418 if(LengthDifferent && SpeedDifferent)
9486 else if(LengthDifferent && !SpeedDifferent)
9633 AnsiString((
short)FirstTrack));
9634 LengthDifferent =
false;
9635 SpeedDifferent =
false;
9640 LengthDifferent =
true;
9644 SpeedDifferent =
true;
9646 if(LengthDifferent || SpeedDifferent)
9659 LengthDifferent =
true;
9663 SpeedDifferent =
true;
9665 if(LengthDifferent || SpeedDifferent)
9678 LengthDifferent =
true;
9682 SpeedDifferent =
true;
9684 if(LengthDifferent || SpeedDifferent)
9764 AnsiString TempName;
9765 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
9766 bool ForwardSet, ReverseSet;
9768 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9773 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9811 for(
int y = 0; y < 2; y++)
9842 StartElement = TempElement;
9843 StartVecPos = VecPos;
9847 StartEntryPos = 1 - Dir;
9856 VecPos = TempElement.
Conn[1 - EntryPos];
9857 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
9859 EntryPos = TempEntryPos;
9887 ForwardNumber = ((Count + 1) / 2) + 1;
9888 ReverseNumber = (Count - ForwardNumber) + 1;
9891 TempElement = StartElement;
9892 VecPos = StartVecPos;
9893 if(Count == ForwardNumber)
9898 if(Count == ReverseNumber)
9906 VecPos = TempElement.
Conn[1 - EntryPos];
9907 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
9909 EntryPos = TempEntryPos;
9911 if(Count == ForwardNumber)
9916 if(Count == ReverseNumber)
9928 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9930 if(
TrackVector.at(x).StationEntryStopLinkPos1 == 5)
9934 if(
TrackVector.at(x).StationEntryStopLinkPos2 == 5)
10064 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10120 if((TextH / 16) - 1 <
HLocMin)
10124 if((TextH / 16) + 1 >
HLocMax)
10128 if((TextV / 16) - 1 <
VLocMin)
10132 if((TextV / 16) + 1 >
VLocMax)
10162 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10163 bool &UserGraphicFoundFlag)
10166 TUserGraphicVector::iterator UserGraphicPtr;
10168 UserGraphicFoundFlag =
false;
10175 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10176 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10178 UserGraphicItem = x;
10179 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10180 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10181 UserGraphicFoundFlag =
true;
10199 int SpeedTag = TrackElement.
SpeedTag;
10203 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10252 return(GraphicOutput);
10260 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10262 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10275 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10276 " in InactiveTrackElementAt");
10287 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10289 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10314 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10315 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10319 if(SNRange.first == SNRange.second)
10324 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10326 if(SNIterator->second < 0)
10336 HVPair.first = InactiveElement.
HLoc;
10337 HVPair.second = InactiveElement.
VLoc;
10341 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
10343 int TVPos =
TrackMap.find(HVPair)->second;
10346 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10352 FirstNamedExitPos = 0;
10354 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
10356 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10357 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10360 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10362 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
10363 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10364 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10367 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10377 FirstNamedExitPos = 1;
10379 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
10381 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10382 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10385 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10387 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
10388 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10389 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10392 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10408 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
10422 AnsiString(FirstNamedElementPos));
10423 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10424 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10426 SecondNamedElementPos = -1;
10427 FirstNamedLinkedElementPos = -1;
10428 SecondNamedLinkedElementPos = -1;
10432 if(SNRange.first == SNRange.second)
10437 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10439 if(SNIterator->second < 0)
10449 HVPair.first = InactiveElement.
HLoc;
10450 HVPair.second = InactiveElement.
VLoc;
10462 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
10466 int TVPos =
TrackMap.find(HVPair)->second;
10467 if(TVPos != FirstNamedElementPos)
10473 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10479 FirstNamedExitPos = 0;
10481 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
10483 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10484 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10487 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10489 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
10490 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10491 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10494 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10496 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10497 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10498 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10507 FirstNamedExitPos = 1;
10509 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
10511 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10512 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10515 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10517 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
10518 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10519 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10522 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10524 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10525 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10526 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10547 if(SNRange.first != SNRange.second)
10549 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10551 if(SNIterator->second < 0)
10573 "," + AnsiString(SpeedTag));
10584 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
10614 else if(SpeedTag == 69)
10640 else if(SpeedTag == 70)
10666 else if(SpeedTag == 71)
10703 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
10704 if(NextEntryPos < 0)
10717 if(NextEntryPos > 1)
10736 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
10748 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
10749 bool FoundFlag =
false;
10764 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
10765 bool FoundFlag =
false;
10790 VPosHi = 16 * VLocHi;
10791 VPosLo = 16 * VLocLo;
10810 AnsiString(EndTVPosition));
10821 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
10822 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
10823 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
10824 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
10826 if(Link0Squares <= Link1Squares)
10844 AnsiString(LinkPos));
10863 if((LinkPos == 1) && (TE.
Attribute == 0))
10868 else if(LinkPos == 1)
10874 else if((LinkPos == 3) && (TE.
Attribute == 1))
10879 else if(LinkPos == 3)
10886 else if(LinkPos == 0)
10891 else if(LinkPos == 1)
10896 else if(LinkPos == 2)
10901 else if(LinkPos == 3)
10906 throw Exception(
"Error, failure in GetExitPos");
10955 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
10959 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11001 "," + AnsiString(DiagonalLinkNumber));
11006 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
11011 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
11016 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
11021 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
11037 AnsiString JustFileName =
"";
11042 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
11049 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
11068 typedef std::list<int> TNamePosList;
11069 TNamePosList NamePosList;
11070 typedef TNamePosList::iterator TNPLIt;
11072 typedef std::list<int> TOnePlatList;
11073 TOnePlatList OnePlatList;
11074 typedef TOnePlatList::iterator TOPLIt;
11077 NamePosList.clear();
11078 OnePlatList.clear();
11079 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11081 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
11083 NamePosList.push_back(x);
11088 if(!NamePosList.empty())
11090 OnePlatList.push_back(NamePosList.back());
11091 NamePosList.pop_back();
11093 while(!OnePlatList.empty())
11095 TempInt = OnePlatList.front();
11098 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
11099 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
11101 OnePlatList.push_back(TempElement.
Conn[0]);
11102 NamePosList.erase(NPLIt);
11104 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
11105 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
11107 OnePlatList.push_back(TempElement.
Conn[1]);
11108 NamePosList.erase(NPLIt);
11111 OnePlatList.erase(OnePlatList.begin());
11112 if(OnePlatList.empty())
11115 if(!NamePosList.empty())
11117 OnePlatList.push_back(NamePosList.back());
11118 NamePosList.pop_back();
11135 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
11150 throw Exception(
"Return value negative in call to LastElementNumber");
11162 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
11176 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
11188 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
11189 " in GetModifiablePrefDirElementAt");
11199 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11201 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
11211 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11213 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
11230 int TrackVectorPosition;
11282 FinishElement =
false;
11283 int TrackVectorPosition;
11305 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
11315 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
11338 for(
int x = 0; x < 4; x++)
11361 FinishElement =
true;
11369 for(
int x = 0; x < 4; x++)
11381 FinishElement =
true;
11389 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11396 .ELinkPos] ==
Lead))
11412 FinishElement =
true;
11431 FinishElement =
true;
11450 FinishElement =
true;
11465 FinishElement =
true;
11474 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11490 FinishElement =
true;
11496 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11519 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
11520 int VectorCount = 0;
11524 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
11526 for(
int x = 0; x < VectorCount; x++)
11533 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
11537 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
11538 SearchElement.
ELinkPos = NextELinkPos;
11559 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
11561 SearchElement.
XLinkPos = NextXLinkPos;
11587 for(
int x = 0; x < VectorCount; x++)
11599 for(
int x = 0; x < VectorCount; x++)
11613 for(
int x = 0; x < VectorCount; x++)
11627 for(
int x = 0; x < VectorCount; x++)
11637 for(
int x = 0; x < VectorCount; x++)
11648 SearchElement.
XLink = SearchElement.
Link[1];
11667 SearchElement.
XLink = SearchElement.
Link[3];
11680 for(
int x = 0; x < VectorCount; x++)
11695 XLinkPos = NextXLinkPos;
11696 CurrentTrackElement = SearchElement;
11715 throw Exception(
"Error, SearchVector empty");
11722 for(
int x = 0; x < 4; x++)
11775 throw Exception(
"Error in EntryExitNumber 1");
11794 if(PrefDirElement.
XLink == -1)
11806 if(PrefDirElement.
XLink != -1)
11810 throw Exception(
"Error in EntryExitNumber 2");
11848 LeadingPoints =
false;
11876 LeadingPoints =
true;
11892 AnsiString ErrorString;
11893 bool Error =
false;
11900 ErrorString =
"HLoc";
11906 ErrorString =
"VLoc";
11912 ErrorString =
"ELink";
11918 ErrorString =
"ELinkPos";
11924 ErrorString =
"XLink";
11930 ErrorString =
"XLinkPos";
11936 ErrorString =
"Tag";
11942 ErrorString =
"TrackVectorPosition";
11948 ErrorString =
"EXNumber";
11955 ErrorString =
"CheckCount";
11962 ErrorString =
"EntryGraphicPtr";
11968 ErrorString =
"EntryDirectionGraphicPtr";
11977 ErrorString =
"Last XLink not connected to this element";
11984 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
12008 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
12065 AnsiString((
short)BuildingPrefDir));
12068 if(PrefDirSize() == 0)
12073 for(
unsigned int x = 0; x < PrefDirSize(); x++)
12085 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
12097 if(x == (PrefDirSize() - 1))
12106 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
12108 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
12109 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
12110 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
12112 if(PrefDirSize() > 1)
12114 unsigned int LatestPos = PrefDirSize() - 1;
12115 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
12116 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
12117 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
12138 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12141 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
12145 H = MMIT->first.first;
12146 V = MMIT->first.second;
12149 if(PrefDirPos0 > -1)
12153 if(PrefDirPos1 > -1)
12157 if(PrefDirPos2 > -1)
12161 if(PrefDirPos3 > -1)
12165 if(PrefDirPos3 > -1)
12181 else if(PrefDirPos2 > -1)
12223 else if(PrefDirPos1 > -1)
12246 else if(PrefDirPos0 > -1)
12265 int NumberOfPrefDirElements = 0;
12268 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12270 VecFile >> TempInt;
12273 VecFile >> TempInt;
12274 LoadPrefDirElement.
ELink = TempInt;
12275 VecFile >> TempInt;
12276 LoadPrefDirElement.
ELinkPos = TempInt;
12277 VecFile >> TempInt;
12278 LoadPrefDirElement.
XLink = TempInt;
12279 VecFile >> TempInt;
12280 LoadPrefDirElement.
XLinkPos = TempInt;
12281 VecFile >> TempInt;
12282 LoadPrefDirElement.
EXNumber = TempInt;
12283 VecFile >> TempInt;
12288 if(!(LoadPrefDirElement.
IsARoute))
12314 int NumberOfPrefDirElements = 0;
12317 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12319 VecFile >> TempInt;
12320 VecFile >> TempInt;
12323 VecFile >> TempInt;
12324 LoadPrefDirElement.
ELink = TempInt;
12325 VecFile >> TempInt;
12326 LoadPrefDirElement.
ELinkPos = TempInt;
12327 VecFile >> TempInt;
12328 LoadPrefDirElement.
XLink = TempInt;
12329 VecFile >> TempInt;
12330 LoadPrefDirElement.
XLinkPos = TempInt;
12331 VecFile >> TempInt;
12332 LoadPrefDirElement.
EXNumber = TempInt;
12333 VecFile >> TempInt;
12338 if(!(LoadPrefDirElement.
IsARoute))
12366 int NumberOfPrefDirElements = 0;
12369 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
12374 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12381 VecFile >> TempInt;
12382 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
12387 VecFile >> TempInt;
12388 if((TempInt < -1) || (TempInt > 9))
12393 VecFile >> TempInt;
12394 if((TempInt < -1) || (TempInt > 3))
12399 VecFile >> TempInt;
12400 if((TempInt < -1) || (TempInt > 9))
12405 VecFile >> TempInt;
12406 if((TempInt < -1) || (TempInt > 3))
12411 VecFile >> TempInt;
12412 if((TempInt < -1) || (TempInt > 27))
12417 VecFile >> TempInt;
12425 VecFile >> TempInt;
12426 if((TempInt != 0) && (TempInt != 1))
12431 VecFile >> TempInt;
12432 if((TempInt != 0) && (TempInt != 1))
12437 VecFile >> TempInt;
12438 if((TempInt != 0) && (TempInt != 1))
12461 for(
int y = 0; y < NumberOfPrefDirElements; y++)
12463 VecFile << y <<
'\n';
12464 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
12474 if(y == (NumberOfPrefDirElements - 1))
12476 VecFile <<
"************" <<
'\0' <<
'\n';
12480 VecFile <<
"******" <<
'\0' <<
'\n';
12494 for(
int y = 0; y < NumberOfSearchElements; y++)
12496 VecFile << y <<
'\n';
12497 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
12507 if(y == (NumberOfSearchElements - 1))
12509 VecFile <<
"************" <<
'\0' <<
'\n';
12513 VecFile <<
"******" <<
'\0' <<
'\n';
12626 bool AlreadyPresent, FoundFlag;
12627 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12629 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
12633 AlreadyPresent =
false;
12638 AlreadyPresent =
true;
12642 AlreadyPresent =
true;
12646 AlreadyPresent =
true;
12650 AlreadyPresent =
true;
12653 if(!AlreadyPresent)
12700 for(
unsigned int z = 0; z < 4; z++)
12708 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
12722 bool DiscrepancyFound =
false;
12733 DiscrepancyFound =
true;
12737 DiscrepancyFound =
true;
12742 DiscrepancyFound =
true;
12747 DiscrepancyFound =
true;
12752 DiscrepancyFound =
true;
12758 DiscrepancyFound =
true;
12761 if(DiscrepancyFound)
12763 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
12778 bool DiscrepancyFound =
false;
12789 DiscrepancyFound =
true;
12793 DiscrepancyFound =
true;
12798 DiscrepancyFound =
true;
12803 DiscrepancyFound =
true;
12808 DiscrepancyFound =
true;
12814 DiscrepancyFound =
true;
12818 return(!DiscrepancyFound);
12830 bool FoundFlag =
false;
12831 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
12839 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
12840 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
12842 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
12844 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
12845 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
12846 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
12851 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
12852 +
" Caller=" + (AnsiString)Caller);
12878 PrefDirMapKeyPair.first = HLoc;
12879 PrefDirMapKeyPair.second = VLoc;
12880 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
12883 if(ItPair.first == ItPair.second)
12891 PrefDirPos0 = ItPair.first->second;
12893 if(ItPair.first == ItPair.second)
12898 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
12900 PrefDirPos1 = ItPair.first->second;
12903 if(ItPair.first == ItPair.second)
12908 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
12910 PrefDirPos2 = ItPair.first->second;
12913 if(ItPair.first == ItPair.second)
12918 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
12920 PrefDirPos3 = ItPair.first->second;
12935 THVPair PrefDir4MultiMapKeyPair;
12938 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
12939 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
12940 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
12963 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
12982 AnsiString(ErasedElementNumber));
12987 if(MapPtr->second > ErasedElementNumber)
13009 throw Exception(
"PrefDirVectorPosition out of range");
13012 THVPair PrefDir4MultiMapKeyPair;
13014 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
13015 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
13016 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13019 if(ItPair.first == ItPair.second)
13022 return(ItPair.first);
13026 if(ItPair.first->second == PrefDirVectorPosition)
13030 return(ItPair.first);
13033 if(ItPair.first == ItPair.second)
13036 return(ItPair.first);
13038 if(ItPair.first->second == PrefDirVectorPosition)
13042 return(ItPair.first);
13045 if(ItPair.first == ItPair.second)
13048 return(ItPair.first);
13050 if(ItPair.first->second == PrefDirVectorPosition)
13054 return(ItPair.first);
13057 if(ItPair.first == ItPair.second)
13060 return(ItPair.first);
13062 if(ItPair.first->second == PrefDirVectorPosition)
13066 return(ItPair.first);
13070 return(ItPair.first);
13083 THVPair PrefDir4MultiMapKeyPair;
13085 PrefDir4MultiMapKeyPair.first = HLoc;
13086 PrefDir4MultiMapKeyPair.second = VLoc;
13087 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13090 if(ItPair.first == ItPair.second)
13098 return(ItPair.first->second);
13107 bool ErasedFlag =
false;
13109 if(ErasedTrackVectorPosition > -1)
13118 ErasedFlag =
false;
13120 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
13125 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
13130 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
13135 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
13140 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
13148 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
13152 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
13156 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
13160 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
13164 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
13179 OverallDistance = 0;
13180 OverallSpeedLimit = 0;
13181 LeadingPointsAtLastElement =
false;
13189 LeadingPointsAtLastElement =
true;
13198 OverallDistance += PrefDirElement.
Length23;
13199 if(OverallSpeedLimit != -1)
13209 OverallSpeedLimit = -1;
13216 OverallDistance += PrefDirElement.
Length01;
13217 if(OverallSpeedLimit != -1)
13227 OverallSpeedLimit = -1;
13246 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13249 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13253 HLoc = MMIT->first.first;
13254 VLoc = MMIT->first.second;
13259 if(PrefDirPos0 > -1)
13263 if(PrefDirPos1 > -1)
13267 if(PrefDirPos2 > -1)
13271 if(PrefDirPos3 > -1)
13275 if(PrefDirPos3 > -1)
13278 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13280 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13282 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13284 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
13291 else if(PrefDirPos2 > -1)
13296 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13298 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13300 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
13309 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13311 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13313 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13322 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13324 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13326 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13333 else if(PrefDirPos1 > -1)
13338 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13340 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13348 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13350 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13356 else if(PrefDirPos0 > -1)
13358 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13375 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13378 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13399 if(PrefDirPos0 > -1)
13403 if(PrefDirPos1 > -1)
13407 if(PrefDirPos2 > -1)
13411 if(PrefDirPos3 > -1)
13415 if(PrefDirPos3 > -1)
13420 else if(PrefDirPos2 > -1)
13422 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
13433 else if(PrefDirPos1 > -1)
13435 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
13446 else if(PrefDirPos0 > -1)
13448 if(PrefDirElement0.
XLinkPos == EntryPos)
13485 ElementIn.
VLoc +
"," + XLink);
13487 bool TrackFoundFlag;
13490 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
13502 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
13512 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13526 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13536 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13550 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13560 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13574 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13584 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
13607 bool FoundFlag, ContFlag, FoundElements =
false;
13608 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13613 LastIteratorValue++;
13638 if(PDVIt->XLinkPos == 0)
13643 StartElement = *PDVIt;
13652 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
13654 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
13655 if(PrefDirPos0 == -1)
13659 bool NextElementFoundFlag =
false;
13663 NextElementFoundFlag =
true;
13665 if(PrefDirPos1 > -1)
13670 NextElementFoundFlag =
true;
13673 if(PrefDirPos2 > -1)
13678 NextElementFoundFlag =
true;
13681 if(PrefDirPos3 > -1)
13686 NextElementFoundFlag =
true;
13689 if(!NextElementFoundFlag)
13719 EndElement = NextElement;
13723 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
13725 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
13726 if(PrefDirPos0 == -1)
13736 if(PrefDirPos1 > -1)
13744 if(PrefDirPos2 > -1)
13752 if(PrefDirPos3 > -1)
13783 FoundElements =
true;
13817 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
13819 int TrackVectorPosition;
13855 int LockedVectorNumber;
13878 bool InPrefDirFlag =
false;
13881 int PrefDirPos0 = -1;
13882 int PrefDirPos1 = -1;
13883 int PrefDirPos2 = -1;
13884 int PrefDirPos3 = -1;
13888 int PrefDirVecPos[4] =
13890 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
13893 for(
int x = 0; x < 4; x++)
13895 int b = PrefDirVecPos[x];
13905 InPrefDirFlag =
true;
13919 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
13927 if(DummyPair.first > -1)
13929 throw Exception(
"Selection in two routes - should never happen!");
13931 if(RoutePair.first > -1)
14007 IDInt &ReqPosRouteID,
bool &PointsChanged)
14041 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
14091 bool InPrefDirFlag =
false;
14094 int PrefDirPos0 = -1;
14095 int PrefDirPos1 = -1;
14096 int PrefDirPos2 = -1;
14097 int PrefDirPos3 = -1;
14100 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14101 int PrefDirVecPos[4] =
14103 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14106 for(
int x = 0; x < 4; x++)
14108 int b = PrefDirVecPos[x];
14111 InPrefDirFlag =
true;
14125 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14134 if(RoutePair.first > -1)
14136 if(RoutePair.second != 0)
14153 EndElement1 = RouteElement;
14154 EndElement2 = BlankElement;
14254 PointsChanged =
true;
14282 PointsChanged =
true;
14305 PointsChanged =
true;
14334 PointsChanged =
true;
14348 PointsChanged =
true;
14367 PointsChanged =
true;
14381 PointsChanged =
true;
14397 PointsChanged =
true;
14451 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag)
14504 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
14505 AnsiString((
short)AutoSigsFlag));
14506 int VectorCount = 0;
14510 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
14514 for(
int x = 0; x < VectorCount; x++)
14522 bool FirstPass =
true;
14532 for(
int x = 0; x < VectorCount; x++)
14541 for(
int x = 0; x < VectorCount; x++)
14553 for(
int x = 0; x < VectorCount; x++)
14561 int NextPosition = PrefDirElement.
Conn[XLinkPos];
14565 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
14566 SearchElement.
ELinkPos = NextELinkPos;
14567 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
14588 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
14590 SearchElement.
XLinkPos = NextXLinkPos;
14602 for(
int x = 0; x < VectorCount; x++)
14616 if(RoutePair.first > -1)
14625 for(
int x = 0; x < VectorCount; x++)
14634 if(SecondPair.first > -1)
14643 for(
int x = 0; x < VectorCount; x++)
14657 for(
int x = 0; x < VectorCount; x++)
14668 for(
int x = 0; x < VectorCount; x++)
14677 for(
int x = 0; x < VectorCount; x++)
14686 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14690 for(
int x = 0; x < VectorCount; x++)
14700 bool InPrefDirFlag =
false;
14701 PrefDirElement1 = BlankElement;
14702 PrefDirElement2 = BlankElement;
14705 int PrefDirPos0 = -1;
14706 int PrefDirPos1 = -1;
14707 int PrefDirPos2 = -1;
14708 int PrefDirPos3 = -1;
14711 int PrefDirVecPos[4] =
14713 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14715 for(
int x = 0; x < 4; x++)
14717 int b = PrefDirVecPos[x];
14720 InPrefDirFlag =
true;
14733 for(
int x = 0; x < VectorCount; x++)
14745 for(
int x = 0; x < VectorCount; x++)
14761 for(
int x = 0; x < VectorCount; x++)
14781 for(
int x = 0; x < VectorCount; x++)
14798 for(
int x = 0; x < VectorCount; x++)
14808 for(
int x = 0; x < VectorCount; x++)
14819 int SearchPos1 = SearchElement.
Attribute + 1;
14821 if(SearchPos1 == 2)
14825 if(SearchPos1 == 1)
14833 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
14834 SearchElement.
XLinkPos = SearchPos1;
14835 InPrefDirFlag =
false;
14836 if(SearchElement.
XLink == PrefDirElement1.
XLink)
14838 SearchElement = PrefDirElement1;
14839 InPrefDirFlag =
true;
14841 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
14843 SearchElement = PrefDirElement2;
14844 InPrefDirFlag =
true;
14850 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14854 for(
int x = 0; x < VectorCount; x++)
14881 for(
int x = 0; x < VectorCount; x++)
14899 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
14900 SearchElement.
XLinkPos = SearchPos2;
14901 if(SearchElement.
XLink == PrefDirElement1.
XLink)
14903 SearchElement = PrefDirElement1;
14905 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
14907 SearchElement = PrefDirElement2;
14911 for(
int x = 0; x < VectorCount; x++)
14919 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14923 for(
int x = 0; x < VectorCount; x++)
14951 for(
int x = 0; x < VectorCount; x++)
14963 for(
int x = 0; x < VectorCount; x++)
14973 SearchElement = PrefDirElement1;
14982 XLinkPos = SearchElement.
XLinkPos;
14983 PrefDirElement = SearchElement;
15040 unsigned int TruncatePrefDirPosition = 0;
15113 throw Exception(
"Error - failed to validate extended route for preferred route");
15168 throw Exception(
"Error - failed to validate single route for preferred route");
15213 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
15215 int TrackVectorPosition;
15252 int LockedVectorNumber;
15286 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
15287 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
15290 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
15296 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
15297 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
15300 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
15314 if(RoutePair.first > -1)
15512 EndElement1.
ELink = EndElement1.
Link[0];
15513 EndElement1.
XLink = EndElement1.
Link[1];
15516 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
15521 EndElement2.
ELink = EndElement2.
Link[1];
15522 EndElement2.
XLink = EndElement2.
Link[0];
15525 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
15569 if(RoutePair.first > -1)
15571 if(RoutePair.second != 0)
15594 EndElement2 = BlankElement;
15679 PointsChanged =
true;
15705 PointsChanged =
true;
15727 PointsChanged =
true;
15753 PointsChanged =
true;
15767 PointsChanged =
true;
15807 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
15808 int VectorCount = 0;
15811 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
15812 (CurrentTrackElement.
Link[XLinkPos] == 9))
15816 for(
int x = 0; x < VectorCount; x++)
15828 for(
int x = 0; x < VectorCount; x++)
15835 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
15837 for(
int x = 0; x < VectorCount; x++)
15844 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
15848 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
15849 SearchElement.
ELinkPos = NextELinkPos;
15870 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
15872 SearchElement.
XLinkPos = NextXLinkPos;
15885 for(
int x = 0; x < VectorCount; x++)
15899 if(RoutePair.first > -1)
15908 for(
int x = 0; x < VectorCount; x++)
15917 if(SecondPair.first > -1)
15926 for(
int x = 0; x < VectorCount; x++)
15940 for(
int x = 0; x < VectorCount; x++)
15951 for(
int x = 0; x < VectorCount; x++)
15960 for(
int x = 0; x < VectorCount; x++)
15969 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15973 for(
int x = 0; x < VectorCount; x++)
15986 for(
int x = 0; x < VectorCount; x++)
16018 for(
int x = 0; x < VectorCount; x++)
16028 for(
int x = 0; x < VectorCount; x++)
16039 int SearchPos1 = SearchElement.
Attribute + 1;
16041 if(SearchPos1 == 2)
16045 if(SearchPos1 == 1)
16054 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16055 SearchElement.
XLinkPos = SearchPos1;
16057 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16061 for(
int x = 0; x < VectorCount; x++)
16086 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16087 SearchElement.
XLinkPos = SearchPos2;
16089 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16093 for(
int x = 0; x < VectorCount; x++)
16112 for(
int x = 0; x < VectorCount; x++)
16127 CurrentTrackElement = SearchElement;
16128 XLinkPos = SearchElement.
XLinkPos;
16150 throw Exception(
"Error, SearchVector empty");
16162 for(
int x = 0; x < 4; x++)
16204 throw Exception(
"Error in EntryExitNumber 3");
16259 unsigned int TruncatePrefDirPosition = 0;
16319 throw Exception(
"Failed to validate extended route for nonpreferred route");
16364 throw Exception(
"Failed to validate single route for nonpreferred route");
16384 if(!PrefDirVector.empty())
16388 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
16393 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
16428 if(!PrefDirVector.empty())
16431 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
16433 int ForwardLinkedRouteNumber, Attribute = 0;
16440 if(ForwardLinkedRouteNumber > -1)
16442 int NextForwardLinkedRouteNumber = -1;
16446 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
16456 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
16476 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
16484 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
16515 NextForwardLinkedRouteNumber = -1;
16516 for(
unsigned int x = 0; x < PrefDirSize(); x++)
16518 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
16519 if(PrefDirVector.at(x).TrackType ==
Bridge)
16521 if(PrefDirVector.at(x).XLinkPos < 2)
16523 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos01;
16527 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos23;
16535 if(PrefDirVector.at(x).TrackType ==
Buffers)
16547 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
16556 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
16558 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
16566 if(x == PrefDirSize() - 1)
16608 AnsiString(PrefDirVectorStartPosition));
16613 bool SkipContinuationAndBufferAttributeChange =
false;
16615 if(!PrefDirVector.empty())
16617 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
16620 if(PrefDirPtr->TrackType ==
Bridge)
16622 if(PrefDirPtr->XLinkPos < 2)
16633 SkipContinuationAndBufferAttributeChange =
true;
16648 SkipContinuationAndBufferAttributeChange =
true;
16656 SkipContinuationAndBufferAttributeChange =
true;
16658 if(!SkipContinuationAndBufferAttributeChange)
16660 if(PrefDirVector.back().TrackType ==
Buffers)
16669 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
16672 if(PrefDirPtr->TrackType ==
Bridge)
16674 if(PrefDirPtr->XLinkPos < 2)
16690 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
16699 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
16701 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
16702 PrefDirPtr->PrefDirRoute)
16749 "," + AnsiString((
short)PrefDirRoute));
16750 bool ElementInRoute =
false;
16751 bool TrainOccupyingRoute =
false;
16757 ElementInRoute =
true;
16761 if(!ElementInRoute)
16789 TrainOccupyingRoute =
true;
16856 if(LRVIT->RouteNumber == RouteNumber)
16870 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
16871 L
"Warning!", MB_YESNO | MB_ICONWARNING);
16883 bool ExistingLockedRouteModified =
false;
16896 if(LRVIT->RouteNumber == RouteNumber)
16900 ExistingLockedRouteModified =
true;
16904 if(!ExistingLockedRouteModified)
16994 AnsiString((
short)PrefDirRoute));
17019 AnsiString((
short)PrefDirRoute));
17029 RouteFlashElement.
HLoc = H;
17030 RouteFlashElement.
VLoc = V;
17046 int H = PrefDirPtr->HLoc;
17047 int V = PrefDirPtr->VLoc;
17114 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
17120 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
17123 OverlayPlotted =
false;
17133 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17135 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
17138 return(AllRoutesVector.at(At));
17147 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17149 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
17152 return(AllRoutesVector.at(At));
17163 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17165 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
17175 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17177 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
17195 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
17196 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17199 RouteTruncateFlag =
true;
17201 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
17202 RouteTruncateFlag =
false;
17231 AnsiString(LinkPos));
17232 if(TrackVectorPosition == -1)
17237 THVPair Route2MultiMapKeyPair;
17241 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17244 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17254 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17256 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17259 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
17260 Route2MultiMapIterator->second.second);
17261 EntryLinkPos = PrefDirElement1.
ELinkPos;
17262 ExitLinkPos = PrefDirElement1.
XLinkPos;
17263 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17264 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17276 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17288 Graphics::TBitmap* &EntryDirectionGraphicPtr)
17298 AnsiString(LinkPos));
17301 if(TrackVectorPosition == -1)
17306 THVPair Route2MultiMapKeyPair;
17310 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17313 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17318 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17320 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17322 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
17323 Route2MultiMapIterator->second.second);
17324 EntryLinkPos = PrefDirElement1.
ELinkPos;
17325 ExitLinkPos = PrefDirElement1.
XLinkPos;
17326 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17327 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17331 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
17332 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17339 return(AutoSigsRoute);
17344 return(NotAutoSigsRoute);
17350 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
17351 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17358 return(AutoSigsRoute);
17363 return(NotAutoSigsRoute);
17367 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17369 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17370 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17372 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
17373 EntryLinkPos = PrefDirElement2.
ELinkPos;
17374 ExitLinkPos = PrefDirElement2.
XLinkPos;
17375 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17376 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17380 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
17387 return(AutoSigsRoute);
17392 return(NotAutoSigsRoute);
17398 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
17405 return(AutoSigsRoute);
17410 return(NotAutoSigsRoute);
17414 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
17415 EntryLinkPos = PrefDirElement3.
ELinkPos;
17416 ExitLinkPos = PrefDirElement3.
XLinkPos;
17417 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17418 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17422 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
17429 return(AutoSigsRoute);
17434 return(NotAutoSigsRoute);
17440 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
17447 return(AutoSigsRoute);
17452 return(NotAutoSigsRoute);
17468 AnsiString(LinkPos));
17469 if(TrackVectorPosition == -1)
17475 THVPair Route2MultiMapKeyPair;
17479 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17482 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17488 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17490 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17492 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
17493 Route2MultiMapIterator->second.second);
17494 EntryLinkPos = PrefDirElement1.
ELinkPos;
17495 ExitLinkPos = PrefDirElement1.
XLinkPos;
17496 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17497 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17500 RouteNumber = Route2MultiMapIterator->second.first;
17504 return(AutoSigsRoute);
17509 return(NotAutoSigsRoute);
17514 RouteNumber = Route2MultiMapIterator->second.first;
17518 return(AutoSigsRoute);
17523 return(NotAutoSigsRoute);
17527 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17529 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17530 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17532 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
17533 EntryLinkPos = PrefDirElement2.
ELinkPos;
17534 ExitLinkPos = PrefDirElement2.
XLinkPos;
17535 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17536 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17539 RouteNumber = ItPair.first->second.first;
17543 return(AutoSigsRoute);
17548 return(NotAutoSigsRoute);
17553 RouteNumber = ItPair.first->second.first;
17557 return(AutoSigsRoute);
17562 return(NotAutoSigsRoute);
17566 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
17567 EntryLinkPos = PrefDirElement3.
ELinkPos;
17568 ExitLinkPos = PrefDirElement3.
XLinkPos;
17569 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17570 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17573 RouteNumber = ItPair.second->second.first;
17577 return(AutoSigsRoute);
17582 return(NotAutoSigsRoute);
17587 RouteNumber = ItPair.second->second.first;
17591 return(AutoSigsRoute);
17596 return(NotAutoSigsRoute);
17618 EmptyRoute.
RouteID = NextRouteID;
17621 AllRoutesVector.push_back(EmptyRoute);
17622 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
17647 AllRoutesVector.push_back(EmptyRoute);
17648 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
17671 THVPair Route2MultiMapKeyPair;
17680 LockedRouteTruncateTrackVectorPosition = 0;
17681 LockedRouteLastTrackVectorPosition = 0;
17682 LockedRouteLastXLinkPos = 0;
17683 LockedRouteLockStartTime = TDateTime(0);
17684 if(!LockedRouteVector.empty())
17688 if(LRVIT->RouteNumber == RouteNumber)
17690 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
17691 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
17692 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
17693 LockedRouteLockStartTime = LRVIT->LockStartTime;
17694 LockedRouteFoundDuringRouteBuilding =
true;
17695 LockedRouteVector.erase(LRVIT);
17720 AnsiString(VLoc) +
"," + AnsiString(ELink));
17723 ReturnPair.first = -1;
17724 ReturnPair.second = 0;
17725 THVPair Route2MultiMapKeyPair;
17727 Route2MultiMapKeyPair.first = HLoc;
17728 Route2MultiMapKeyPair.second = VLoc;
17731 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
17732 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17734 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17735 Route2MultiMapIterator = ItPair.first;
17737 if(ItPair.first == ItPair.second)
17739 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
17741 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
17743 ReturnPair.first = ItPair.first->second.first;
17744 ReturnPair.second = ItPair.first->second.second;
17745 Route2MultiMapIterator = ItPair.first;
17747 return(ReturnPair);
17750 if(ItPair.first == ItPair.second)
17752 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
17754 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
17756 ReturnPair.first = ItPair.first->second.first;
17757 ReturnPair.second = ItPair.first->second.second;
17758 Route2MultiMapIterator = ItPair.first;
17760 return(ReturnPair);
17763 return(ReturnPair);
17778 AnsiString(VLoc) +
"," + AnsiString(ELink));
17779 THVPair Route2MultiMapKeyPair;
17781 Route2MultiMapKeyPair.first = HLoc;
17782 Route2MultiMapKeyPair.second = VLoc;
17783 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17785 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17787 if(ItPair.first == ItPair.second)
17793 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
17795 RouteNumber = ItPair.first->second.first;
17801 if(ItPair.first == ItPair.second)
17807 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
17809 RouteNumber = ItPair.first->second.first;
17830 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
17831 THVPair Route2MultiMapKeyPair;
17833 Route2MultiMapKeyPair.first = HLoc;
17834 Route2MultiMapKeyPair.second = VLoc;
17837 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
17840 RouteElementPair.first = RouteNumber;
17841 RouteElementPair.second = RouteElementNumber;
17842 Route2MultiMapEntry.second = RouteElementPair;
17844 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
17847 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
17848 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
17851 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
17852 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
17854 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
17856 Route2MultiMap.insert(Route2MultiMapEntry);
17861 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
17866 Route2MultiMap.insert(Route2MultiMapEntry);
17884 TempPair.first = -1;
17885 TempPair.second = 0;
17886 SecondPair = TempPair;
17888 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
17889 THVPair Route2MultiMapKeyPair;
17891 Route2MultiMapKeyPair.first = HLoc;
17892 Route2MultiMapKeyPair.second = VLoc;
17893 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17898 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17900 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17902 return(Route2MultiMapIterator->second);
17904 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17906 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17907 TempPair = ItRange.first->second;
17908 SecondPair = (--ItRange.second)->second;
17931 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
17932 if(RouteElementPair.first == -1)
17935 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
17936 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
17938 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
17941 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
17942 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
17943 (AnsiString)Caller);
17945 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
17948 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
17949 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
17950 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
17951 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
17955 unsigned int SizeVal = 0;
17958 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17960 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
17962 if(SizeVal != Route2MultiMap.size())
17964 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
17965 (AnsiString)Caller);
17981 if(!Route2MultiMap.empty())
17983 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
17985 if(Route2MultiMapIterator->second.first > RouteNumber)
17987 Route2MultiMapIterator->second.first--;
18004 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
18005 if(!Route2MultiMap.empty())
18007 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18009 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
18011 Route2MultiMapIterator->second.second--;
18030 AnsiString(ELink));
18034 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
18035 if(RequiredRoutePair.first == -1)
18037 throw Exception(
"Failed to find route element in RemoveRouteElement");
18039 Route2MultiMap.erase(Route2MultiMapIterator);
18040 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
18043 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
18064 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
18065 RequiredRoutePair.second)));
18076 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
18084 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
18086 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
18087 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
18088 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
18100 if(!LockedRouteVector.empty())
18104 if(LRVIT->RouteNumber > RequiredRoutePair.first)
18106 LRVIT->RouteNumber--;
18116 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
18118 AutoSigVectorIT->RouteNumber--;
18123 CheckMapAndRoutes(7);
18137 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
18138 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
18139 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
18155 "," + AnsiString(XLinkPos));
18159 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
18160 if(RouteElementPair.first == -1)
18162 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
18164 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
18166 RequiredPair = RouteElementPair;
18167 if(RouteElement.
XLinkPos != XLinkPos)
18169 if(SecondPair.first != -1)
18171 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
18172 RequiredPair = SecondPair;
18173 if(RouteElement.
XLinkPos != XLinkPos)
18175 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
18180 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
18184 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
18204 AnsiString(AccessNumber));
18206 int Attribute = AccessNumber + 1;
18208 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
18212 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
18216 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
18219 x).XLinkPos] !=
End)
18221 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
18224 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
18266 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
18267 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
18268 int RearwardLinkedRouteNumber;
18294 int TrainID, TrainPosition, BehindTrainPosition;
18295 bool FoundTrain =
false, BehindTrain =
false;
18296 for(
int x = RouteStartPosition; x >= 0; x--)
18298 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
18323 if(FoundTrain && (TrainPosition > 1))
18325 for(
int x = TrainPosition; x >= 0; x--)
18330 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
18350 BehindTrain =
true;
18351 BehindTrainPosition = x;
18358 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
18375 AnsiString(RouteTruncatePosition));
18376 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
18377 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
18380 bool ExamineRoute =
true;
18382 while(ExamineRoute)
18384 for(
int x = StartPosition; x >= 0; x--)
18426 if(SignalCount >= 3)
18445 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
18446 ExamineRoute =
true;
18447 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
18482 ExamineRoute =
false;
18497 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
18500 PrefDirElement = InternalPrefDirElement;
18501 if(LockedRouteVector.empty())
18508 bool InLockedRoute =
false;
18512 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
18516 InLockedRoute =
true;
18525 int RouteNumber, VectorCount = 0;
18530 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
18531 if(RouteType == NoRoute)
18537 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
18540 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
18542 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
18544 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
18545 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
18549 PrefDirElement = InternalPrefDirElement;
18550 LockedVectorNumber = VectorCount;
18555 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
18559 PrefDirElement = InternalPrefDirElement;
18560 LockedVectorNumber = VectorCount;
18581 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18583 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
18589 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
18599 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18601 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
18616 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18618 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
18621 return(GetFixedRouteAt(159, x));
18624 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
18632 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18634 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
18637 return(GetModifiableRouteAt(15, x));
18640 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
18650 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18652 TOneRoute OneRoute = GetFixedRouteAt(165, x);
18664 int NumberOfRoutes;
18668 for(
int x = 0; x < NumberOfRoutes; x++)
18675 StoreOneRouteAfterSessionLoad(0, &OneRoute);
18693 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
18700 if((NextID < 0) || (NextID > 1000000))
18705 for(
int x = 0; x < NumberOfRoutes; x++)
18730 AnsiString(StartPosition));
18731 if(EndPosition == StartPosition)
18737 int TVPos = EndPosition;
18738 int LkPos = EndXLinkPos;
18740 while(TrackIsInARoute(15, TVPos, LkPos))
18767 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
18776 if((NewLkPos == 0) || (NewLkPos == 2))
18796 if(TVPos == StartPosition)
18828 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
18833 if(FirstPair.first > -1)
18836 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
18841 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
18847 if(SecondPair.first > -1)
18850 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
18855 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
18861 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
18868 if(FirstPair.first > -1)
18871 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
18876 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
18882 if(SecondPair.first > -1)
18885 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
18890 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
18896 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
18903 if(FirstPair.first > -1)
18906 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
18911 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
18917 if(SecondPair.first > -1)
18920 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
18925 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
18931 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
18938 if(FirstPair.first > -1)
18941 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
18946 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
18952 if(SecondPair.first > -1)
18955 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
18960 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
18966 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
18990 "," + AnsiString(DiagonalLinkNumber));
18995 if(FirstPair.first > -1)
18998 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19003 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19009 if(SecondPair.first > -1)
19012 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19017 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19024 if(FirstPair.first > -1)
19027 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19032 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19038 if(SecondPair.first > -1)
19041 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19046 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19053 if(FirstPair.first > -1)
19056 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19061 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19067 if(SecondPair.first > -1)
19070 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19075 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19082 if(FirstPair.first > -1)
19085 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19090 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19096 if(SecondPair.first > -1)
19099 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19104 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))